package com.lyb.command.impl;

import com.lyb.command.AlpacaCommand;

/**
 * ahuang 命令处理类
 *
 * @author ahuang
 * @version 1.4.0
 */
public class AhuangCommand implements AlpacaCommand {
    /**
     * 表示该类负责处理的命令
     */
    private static final String COMMAND = "ahuang";

    /**
     * 格式判断，输入语句需满足以下情况
     * 1.格式：{"ahuang"}
     * 2.没有参数
     *
     * @param input 用户输入的语句(已切分)
     * @return 判断结果
     */
    @Override
    public boolean formatJudge(String[] input) {
        /* 若输入语句有参数则错误 */
        return input.length == 1;
    }

    /**
     * 运行命令，调用相关函数输出操作结果
     *
     * @param command 命令语句
     */
    @Override
    public void go(String[] command) {
        String ahuang = "\n" +
                "db   db d88888b db      db       .d88b.\n" +
                "88   88 88'     88      88      .8P  Y8. \n" +
                "88ooo88 88ooooo 88      88      88    88\n" +
                "88~~~88 88~~~~~ 88      88      88    88\n" +
                "88   88 88.     88booo. 88booo. `8b  d8'\n" +
                "YP   YP Y88888P Y88888P Y88888P  `Y88P'  \n" +
                " \n" +
                "db   d8b   db  .d88b.  d8888b. db      d8888b.\n" +
                "88   I8I   88 .8P  Y8. 88  `8D 88      88  `8D\n" +
                "88   I8I   88 88    88 88oobY' 88      88   88 \n" +
                "Y8   I8I   88 88    88 88`8b   88      88   88 \n" +
                "`8b d8'8b d8' `8b  d8' 88 `88. 88booo. 88  .8D \n" +
                " `8b8' `8d8'   `Y88P'  88   YD Y88888P Y8888D'    \n";

        for (int i = 0; i < ahuang.length(); i++) {
            try {
                /* 一个一个打印字符 */
                Thread.sleep(5);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.print(ahuang.charAt(i));
        }
    }

    @Override
    public String getCommand() {
        return COMMAND;
    }
}
